<?php

namespace App\Console;

use App\Components\Goods\Commands\Off;
use App\Console\Commands\GetToken;
use App\Console\Commands\wqb;
use App\Modules\System\Commands\Rank;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
        wqb::class,
        GetToken::class,
        Rank::class,
        Off::class,
        \App\Components\Package\Commands\Off::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
        $schedule->command('goods:off')->runInBackground()->everyMinute()->description("下架");
        $schedule->command('package:off')->runInBackground()->everyMinute()->description("下架");
        $schedule->command('rank:refresh')->runInBackground()->hourly()->description("刷新排行榜");

        \App\Modules\Order\Schedule::invoke($schedule);
        \App\Modules\Order\Schedule::invoke($schedule);
        \App\Modules\Shop\Schedule::invoke($schedule);
        \App\Modules\User\Schedule::invoke($schedule);
        \App\Modules\Rebate\Schedule::invoke($schedule);
        \App\Modules\Common\Schedule::invoke($schedule);
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
